<%-- 
    Document   : test
    Created on : Nov 17, 2013, 11:28:05 PM
    Author     : Min Tun
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script type="text/javascript">
            function toArraySearchString(searchKey){
                var arr = new Array();
                arr = searchKey.split(" ");
                document.write(arr.join(","));
            }

            function convertSearchKey(work){
                var st = work;
                var arr1 = new Array("Á", "À", "Ả", "Ã", "Ạ", "á", "à", "ả", "ã", "ạ");
                var arr2 = new Array("a", "a", "a", "a", "a", "a", "a", "a", "a", "a");
                for(var i = 0; i < work.length; i ++) {
                    for (var j = 0; j < arr1.length; j ++){
                        if(st[i] == arr1[j]){
                            st[i] = arr2[j];
                        }
                    }
                }
                document.write(work.length);
            }
        </script>
    </head>
    <body>
        <h1>Hello World!</h1>
        <input name="search" id="search" value="" type="text"/>
        <input type="button" value="Test" onclick="convertSearchKey(document.getElementById('search').value)"/>
    </body>
</html>
